import java.util.ArrayList;
import java.util.Arrays;

public class Compare {

	public static int valuA;
	public static int valuB;
	public static int valuC;
	public static int valuD;
	public static int valuE;
	public static int valuF;
	public static ArrayList<Integer> values = new ArrayList<Integer>();
	public static double suitA;
	public static double suitB;
	public static double suitC;
	public static double suitD;
	public static double suitE;
	public static double suitF;
	public static String Asuit;
	public static String Bsuit;
	public static String Csuit;
	public static String Dsuit;
	public static String Esuit;
	public static String Fsuit;

	public static int tempRank;

	public static int up = 400;
	public static int down = 200;
	public static int s9edit = 800;
	public static int s8edit = 710;
	public static int s7edit = 620;
	public static int s6edit = 530;
	public static int s5edit = 440;
	public static int s4edit = 350;
	public static int s3edit = 260;
	public static int s2edit = 170;
	public static int s1edit = 80;

	public static void main(String[] args) {
		if (Board.S1full != true && Board.S1a >= 0 && Board.S1b >= 0
				&& Board.S1c >= 0 && Board.S1d >= 0 && Board.S1e >= 0
				&& Board.S1f >= 0) {
			System.out.println("Stone 1 full");
			Board.S1full = true;

			// comparisons for dealer
			compare(Board.S1a, Board.S1b, Board.S1c, Board.S1d, Board.S1e,
					Board.S1f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "1d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S1a, Board.S1b, Board.S1c, Board.S1d, Board.S1e,
					Board.S1f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "1p");
			tempRank = 0;

			Card.compareRank(Board.S1rank, Board.S1rankp, 100, 325, s1edit, up,
					s1edit, down);
			if (Board.S1rank > Board.S1rankp) {
				Board.ownS1 = "d";
			} else {
				Board.ownS1 = "p";
			}
			Board.gameWon();
		}
		if (Board.S2full != true && Board.S2a >= 0 && Board.S2b >= 0
				&& Board.S2c >= 0 && Board.S2d >= 0 && Board.S2e >= 0
				&& Board.S2f >= 0) {
			System.out.println("Stone 2 full");
			Board.S2full = true;

			// comparisons for dealer
			compare(Board.S2a, Board.S2b, Board.S2c, Board.S2d, Board.S2e,
					Board.S2f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "2d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S2a, Board.S2b, Board.S2c, Board.S2d, Board.S2e,
					Board.S2f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "2p");
			tempRank = 0;

			Card.compareRank(Board.S2rank, Board.S2rankp, 190, 325, s2edit, up,
					s2edit, down);
			if (Board.S2rank > Board.S2rankp) {
				Board.ownS2 = "d";
			} else {
				Board.ownS2 = "p";
			}
			Board.gameWon();
		}
		if (Board.S3full != true && Board.S3a >= 0 && Board.S3b >= 0
				&& Board.S3c >= 0 && Board.S3d >= 0 && Board.S3e >= 0
				&& Board.S3f >= 0) {
			System.out.println("Stone 3 full");
			Board.S3full = true;

			// comparisons for dealer
			compare(Board.S3a, Board.S3b, Board.S3c, Board.S3d, Board.S3e,
					Board.S3f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "3d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S3a, Board.S3b, Board.S3c, Board.S3d, Board.S3e,
					Board.S3f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "3p");
			tempRank = 0;

			Card.compareRank(Board.S3rank, Board.S3rankp, 290, 325, s3edit, up,
					s3edit, down);
			if (Board.S3rank > Board.S3rankp) {
				Board.ownS3 = "d";
			} else {
				Board.ownS3 = "p";
			}
			Board.gameWon();
		}
		if (Board.S4full != true && Board.S4a >= 0 && Board.S4b >= 0
				&& Board.S4c >= 0 && Board.S4d >= 0 && Board.S4e >= 0
				&& Board.S4f >= 0) {
			System.out.println("Stone 4 full");
			Board.S4full = true;

			// comparisons for dealer
			compare(Board.S4a, Board.S4b, Board.S4c, Board.S4d, Board.S4e,
					Board.S4f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "4d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S4a, Board.S4b, Board.S4c, Board.S4d, Board.S4e,
					Board.S4f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "4p");
			tempRank = 0;

			Card.compareRank(Board.S4rank, Board.S4rankp, 390, 325, s4edit, up,
					s4edit, down);
			if (Board.S4rank > Board.S4rankp) {
				Board.ownS4 = "d";
			} else {
				Board.ownS4 = "p";
			}
			Board.gameWon();
		}
		if (Board.S5full != true && Board.S5a >= 0 && Board.S5b >= 0
				&& Board.S5c >= 0 && Board.S5d >= 0 && Board.S5e >= 0
				&& Board.S5f >= 0) {
			System.out.println("Stone 5 full");
			Board.S5full = true;

			// comparisons for dealer
			compare(Board.S5a, Board.S5b, Board.S5c, Board.S5d, Board.S5e,
					Board.S5f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "5d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S5a, Board.S5b, Board.S5c, Board.S5d, Board.S5e,
					Board.S5f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "5p");
			tempRank = 0;

			Card.compareRank(Board.S5rank, Board.S5rankp, 485, 325, s5edit, up,
					s5edit, down);
			if (Board.S5rank > Board.S5rankp) {
				Board.ownS5 = "d";
			} else {
				Board.ownS5 = "p";
			}
			Board.gameWon();
		}
		if (Board.S6full != true && Board.S6a >= 0 && Board.S6b >= 0
				&& Board.S6c >= 0 && Board.S6d >= 0 && Board.S6e >= 0
				&& Board.S6f >= 0) {
			System.out.println("Stone 6 full");
			Board.S6full = true;

			// comparisons for dealer
			compare(Board.S6a, Board.S6b, Board.S6c, Board.S6d, Board.S6e,
					Board.S6f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "6d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S6a, Board.S6b, Board.S6c, Board.S6d, Board.S6e,
					Board.S6f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "6p");
			tempRank = 0;

			Card.compareRank(Board.S6rank, Board.S6rankp, 575, 325, s6edit, up,
					s6edit, down);
			if (Board.S6rank > Board.S6rankp) {
				Board.ownS6 = "d";
			} else {
				Board.ownS6 = "p";
			}
			Board.gameWon();
		}
		if (Board.S7full != true && Board.S7a >= 0 && Board.S7b >= 0
				&& Board.S7c >= 0 && Board.S7d >= 0 && Board.S7e >= 0
				&& Board.S7f >= 0) {
			System.out.println("Stone 7 full");
			Board.S7full = true;

			// comparisons for dealer
			compare(Board.S7a, Board.S7b, Board.S7c, Board.S7d, Board.S7e,
					Board.S7f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "7d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S7a, Board.S7b, Board.S7c, Board.S7d, Board.S7e,
					Board.S7f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "7p");
			tempRank = 0;

			Card.compareRank(Board.S7rank, Board.S7rankp, 675, 325, s7edit, up,
					s7edit, down);
			if (Board.S7rank > Board.S7rankp) {
				Board.ownS7 = "d";
			} else {
				Board.ownS7 = "p";
			}
			Board.gameWon();
		}
		if (Board.S8full != true && Board.S8a >= 0 && Board.S8b >= 0
				&& Board.S8c >= 0 && Board.S8d >= 0 && Board.S8e >= 0
				&& Board.S8f >= 0) {
			System.out.println("Stone 8 full");
			Board.S8full = true;

			// comparisons for dealer
			compare(Board.S8a, Board.S8b, Board.S8c, Board.S8d, Board.S8e,
					Board.S8f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "8d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S8a, Board.S8b, Board.S8c, Board.S8d, Board.S8e,
					Board.S8f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "8p");
			tempRank = 0;

			Card.compareRank(Board.S8rank, Board.S8rankp, 775, 325, s8edit, up,
					s8edit, down);
			if (Board.S8rank > Board.S8rankp) {
				Board.ownS8 = "d";
			} else {
				Board.ownS8 = "p";
			}
			Board.gameWon();
		}
		if (Board.S9full != true && Board.S9a >= 0 && Board.S9b >= 0
				&& Board.S9c >= 0 && Board.S9d >= 0 && Board.S9e >= 0
				&& Board.S9f >= 0) {
			System.out.println("Stone 9 full");
			Board.S9full = true;

			// comparisons for dealer
			compare(Board.S9a, Board.S9b, Board.S9c, Board.S9d, Board.S9e,
					Board.S9f);
			straightFlush(values.get(0), values.get(1), values.get(2), Asuit,
					Bsuit, Csuit);
			highSumTotal(values.get(0), values.get(1), values.get(2));
			Board.updateRank(tempRank, "9d");
			tempRank = 0;

			// comparisons for player
			compare(Board.S9a, Board.S9b, Board.S9c, Board.S9d, Board.S9e,
					Board.S9f);
			straightFlush(values.get(3), values.get(4), values.get(5), Dsuit,
					Esuit, Fsuit);
			highSumTotal(values.get(3), values.get(4), values.get(5));
			Board.updateRank(tempRank, "9p");
			tempRank = 0;

			Card.compareRank(Board.S9rank, Board.S9rankp, 870, 325, s9edit, up,
					s9edit, down);
			if (Board.S9rank > Board.S9rankp) {
				Board.ownS9 = "d";
			} else {
				Board.ownS9 = "p";
			}
			Board.gameWon();
		}
	}

	public static void compare(int a, int b, int c, int d, int e, int f) {
		valuA = (a % 9) + 1;
		valuB = (b % 9) + 1;
		valuC = (c % 9) + 1;
		valuD = (d % 9) + 1;
		valuE = (e % 9) + 1;
		valuF = (f % 9) + 1;
		values.add(0, valuA);
		values.add(1, valuB);
		values.add(2, valuC);
		values.add(3, valuD);
		values.add(4, valuE);
		values.add(5, valuF);

		// A card
		if (a >= 0 && a <= 8) {
			Asuit = "Red";
		} else if (a >= 9 && a <= 17) {
			Asuit = "White";
		} else if (a >= 18 && a <= 26) {
			Asuit = "Yellow";
		} else if (a >= 27 && a <= 35) {
			Asuit = "Orange";
		} else if (a >= 36 && a <= 44) {
			Asuit = "Purple";
		} else if (a >= 45 && a <= 53) {
			Asuit = "Black";
		}

		// B card
		if (b >= 0 && b <= 8) {
			Bsuit = "Red";
		} else if (b >= 9 && b <= 17) {
			Bsuit = "White";
		} else if (b >= 18 && b <= 26) {
			Bsuit = "Yellow";
		} else if (b >= 27 && b <= 35) {
			Bsuit = "Orange";
		} else if (b >= 36 && b <= 44) {
			Bsuit = "Purple";
		} else if (b >= 45 && b <= 53) {
			Bsuit = "Black";
		}

		// C card
		if (c >= 0 && c <= 8) {
			Csuit = "Red";
		} else if (c >= 9 && c <= 17) {
			Csuit = "White";
		} else if (c >= 18 && c <= 26) {
			Csuit = "Yellow";
		} else if (c >= 27 && c <= 35) {
			Csuit = "Orange";
		} else if (c >= 36 && c <= 44) {
			Csuit = "Purple";
		} else if (c >= 45 && c <= 53) {
			Csuit = "Black";
		}

		// D card
		if (d >= 0 && d <= 8) {
			Dsuit = "Red";
		} else if (d >= 9 && d <= 17) {
			Dsuit = "White";
		} else if (d >= 18 && d <= 26) {
			Dsuit = "Yellow";
		} else if (d >= 27 && d <= 35) {
			Dsuit = "Orange";
		} else if (d >= 36 && d <= 44) {
			Dsuit = "Purple";
		} else if (d >= 45 && d <= 53) {
			Dsuit = "Black";
		}

		// E card
		if (e >= 0 && e <= 8) {
			Esuit = "Red";
		} else if (e >= 9 && e <= 17) {
			Esuit = "White";
		} else if (e >= 18 && e <= 26) {
			Esuit = "Yellow";
		} else if (e >= 27 && e <= 35) {
			Esuit = "Orange";
		} else if (e >= 36 && e <= 44) {
			Esuit = "Purple";
		} else if (e >= 45 && e <= 53) {
			Esuit = "Black";
		}

		// F card
		if (f >= 0 && f <= 8) {
			Fsuit = "Red";
		} else if (f >= 9 && f <= 17) {
			Fsuit = "White";
		} else if (f >= 18 && f <= 26) {
			Fsuit = "Yellow";
		} else if (f >= 27 && f <= 35) {
			Fsuit = "Orange";
		} else if (f >= 36 && f <= 44) {
			Fsuit = "Purple";
		} else if (f >= 45 && f <= 53) {
			Fsuit = "Black";
		}

	}

	public static void straightFlush(int x, int y, int z, String s1, String s2,
			String s3) {
		int[] temp = { x, y, z };
		Arrays.sort(temp);
		int temp1 = temp[0];
		int temp2 = temp[1];
		int temp3 = temp[2];
		if (s1.equals(s2) && s2.equals(s3) && temp1 + 1 == temp2
				&& temp2 + 1 == temp3) {
			System.out.println("straight flush");
			tempRank = 400;
		} else {
			System.out.println("NOT A STRAIGHT FLUSH");
			// hwhayat
			threeofaKind(x, y, z, s1, s2, s3);
		}
	}

	public static void threeofaKind(int x, int y, int z, String s1, String s2,
			String s3) {
		if (s1 != s2 && s2 != s3 && x == y && y == z) {
			System.out.println("3 of a kind");
			tempRank = 300;
		} else {
			System.out.println("NOT 3 OF A KIND");
			// whatsiadjf
			flush(x, y, z, s1, s2, s3);
		}
	}

	public static void flush(int x, int y, int z, String s1, String s2,
			String s3) {
		if (s1.equals(s2) && s2.equals(s3)) {
			System.out.println("flush");
			tempRank = 200;
		} else {
			System.out.println("NOT FLUSH");
		}
		// sdfhdfcv
		straight(x, y, z, s1, s2, s3);
	}

	public static void straight(int x, int y, int z, String s1, String s2,
			String s3) {
		int[] temp = { x, y, z };
		Arrays.sort(temp);
		int temp1 = temp[0];
		int temp2 = temp[1];
		int temp3 = temp[2];
		if (temp1 + 1 == temp2 && temp2 + 1 == temp3) {
			System.out.println("straight");
			tempRank = 100;
		} else {
			System.out.println("NOT STRAIGHT");
		}
	}

	public static void highSumTotal(int x, int y, int z) {
		int total = x + y + z;
		System.out.println("high sum total is " + total);
		tempRank = tempRank + total;
	}
}
